package com.hundsun.fcp.receivers;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.hundsun.fcp.base.BaseProtectActivity;

public class SystemLotteryReceivers extends BroadcastReceiver {
	private String action = null;  
	String SYSTEM_REASON = "reason";  
    String SYSTEM_HOME_KEY = "homekey";  
    String SYSTEM_HOME_KEY_LONG = "recentapps";  
	@Override
	public void onReceive(Context context, Intent intent) {
		action = intent.getAction();  
        if(Intent.ACTION_SCREEN_OFF.equals(action)/*||Intent.ACTION_SCREEN_ON.equals(action)*/){  
            BaseProtectActivity.setNeedLock(true) ;
            BaseProtectActivity.setLockTime() ;
        }
        
        if(action.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)){
        	String reason = intent.getStringExtra(SYSTEM_REASON);  
            if (TextUtils.equals(reason, SYSTEM_HOME_KEY)) {  
                 //表示按了home键,程序到了后台  
            	BaseProtectActivity.setNeedLock(true) ;
            	BaseProtectActivity.setLockTime() ;
            }
        }
	}

}
